import { Prop, Schema, SchemaFactory } from '@nestjs/mongoose';
import { Document, Types } from 'mongoose';

@Schema()
export class User extends Document {
  @Prop()
  name: string;

  @Prop()
  age: number;

  @Prop()
  breed: string;

  // see https://github.com/nestjs/mongoose/issues/2421
  @Prop({
    type: [{ type: Types.ObjectId, ref: User.name }],
    default: [],
  })
  kitten: Types.ObjectId[];
}

export const UserSchema = SchemaFactory.createForClass(User);